//var app = require('http').createServer();
//var io = module.exports = require('socket.io').listen(app);
//app.listen(4000);
var server = require('./../httpserver').server;
var io = module.exports = require('socket.io').listen(server);
//WebSocket连接监听
io.on('connection', function (socket) {
//  console.log(io.sockets.sockets.length);
  // console.log('-------------------------------------------------------');
  console.log(socket.id);
  // socket.emit('message',socket.id);
  socket.emit('open');//通知客户端已连接
  //传递身份标示ID
  socket.emit('system',socket.id);
  //监听出退事件
  socket.on('disconnect', function () {
//    console.log(socket.id+'断开连接');
  });
  socket.on('reconnect', function(){
//    console.log(socket.id+'重新连接');
  });

});